package com.dundun.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName message
 */
@TableName(value ="message")
@Data
public class Message implements Serializable {
    /**
     * 消息id
     */
    @TableId(type = IdType.AUTO)
    private Long messageId;

    /**
     * 消息发送者
     */
    private Long messageFrom;

    /**
     * 消息接收者
     */
    private Long messageTo;

    /**
     * 消息种类（0：文本消息 1：图片消息）
     */
    private Integer messageType;

    /**
     * 消息内容（文本消息：文本内容 图片消息：图片地址）
     */
    private String messageContent;

    /**
     * 消息发送时间
     */
    private Date messageTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Message other = (Message) that;
        return (this.getMessageId() == null ? other.getMessageId() == null : this.getMessageId().equals(other.getMessageId()))
            && (this.getMessageFrom() == null ? other.getMessageFrom() == null : this.getMessageFrom().equals(other.getMessageFrom()))
            && (this.getMessageTo() == null ? other.getMessageTo() == null : this.getMessageTo().equals(other.getMessageTo()))
            && (this.getMessageType() == null ? other.getMessageType() == null : this.getMessageType().equals(other.getMessageType()))
            && (this.getMessageContent() == null ? other.getMessageContent() == null : this.getMessageContent().equals(other.getMessageContent()))
            && (this.getMessageTime() == null ? other.getMessageTime() == null : this.getMessageTime().equals(other.getMessageTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getMessageId() == null) ? 0 : getMessageId().hashCode());
        result = prime * result + ((getMessageFrom() == null) ? 0 : getMessageFrom().hashCode());
        result = prime * result + ((getMessageTo() == null) ? 0 : getMessageTo().hashCode());
        result = prime * result + ((getMessageType() == null) ? 0 : getMessageType().hashCode());
        result = prime * result + ((getMessageContent() == null) ? 0 : getMessageContent().hashCode());
        result = prime * result + ((getMessageTime() == null) ? 0 : getMessageTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", messageId=").append(messageId);
        sb.append(", messageFrom=").append(messageFrom);
        sb.append(", messageTo=").append(messageTo);
        sb.append(", messageType=").append(messageType);
        sb.append(", messageContent=").append(messageContent);
        sb.append(", messageTime=").append(messageTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}